package com.andriod.waker;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class MySocketServer implements Runnable
{

	private int port = 0;
	private ServerSocket server;
	private static boolean listen = true;
	private DataInputStream dis;
	private DataOutputStream dos;
	private Socket client;
	
	public MySocketServer(int w_port)
	{
		port = w_port;
	}
	
	public void run() {
		// TODO Auto-generated method stub
		
		try {
			server = new ServerSocket(port);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		while(listen)
		{
			try {
				client = server.accept();
				dis = new DataInputStream(client.getInputStream());
				
				dis.close();
				client.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
